#!/usr/bin/expect
#This script used for autostart openvpn-client for linux system
#Written by Wesley,Zhang  2017/09/15 

set timeout 20
set user [lindex $argv 0]
set password [lindex $argv 1]

spawn openvpn --config /etc/openvpn/client/bonc_shanxi.ovpn --log /etc/openvpn/client/bonc_shanxi.log
expect "*sername:*"
send "$user\r"
expect "*assword:*"
send "$password\r"
expect eof
spawn echo "VPN正在启动，请静候1分钟。"
